<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
<!--    <meta name="viewport" content="width=device-width, initial-scale=1.0">-->
    <title>Title</title>
    <link rel="stylesheet" href="./style/index.css">
    <!-- 引入fastclick库 -->
    <script src="https://as.alipayobjects.com/g/component/fastclick/1.0.6/fastclick.js"></script>
    <!-- 使用fastclick库 -->
    <script>
        if ("addEventListener" in document) {
            document.addEventListener(
                "DOMContentLoaded",
                function () {
                    FastClick.attach(document.body);
                },
                false
            );
        }
    </script>
</head>
<body>
<div id="root"></div>
</body>
<script>

    const root = document.querySelector("#root");
    // click与touchstart同时拥有的话，先执行touchstart，再执行click,
    // 如果在未开启完美视口时，间隔为300ms左右。
    // 1- 使用完美视口
    // 2- fastclick
    let num = 0;
    root.addEventListener("click",function(){
        console.log("click",Date.now()-num);
    })
    root.addEventListener("touchstart",function(){
        num = Date.now();
        console.log("touchstart");
    })






    // 设计稿 75
    function adapter(){
        document.documentElement.style.fontSize = document.documentElement.clientWidth/10+"px";
    }
    adapter();
    window.onresize = adapter;
</script>
</html>